#include <iostream>
using namespace std;

class Time; // 类的前向声明

class Date{
    private:
        int year;
        int mon;
        int day;
    public:
        Date(){}
        Date(int y, int m, int d):year(y), mon(m), day(d){}
        ~Date(){}
        void show_date_and_time(Time &r);
};

class Time{
    private:
        int hour;
        int min;
        int sec;
    public:
        Time(){}
        Time(int h, int m, int s):hour(h), min(m), sec(s){}
        ~Time(){}
        // 声明 Date::show_date_and_time 是 Time 类的友元函数
        // 在 Date::show_date_and_time 函数中就可以访问 Time 类的私有成员了
        friend void Date::show_date_and_time(Time &r);
};

void Date::show_date_and_time(Time &r){
    cout << year << "-" << mon << "-" << day << endl;
    cout << r.hour << ":" << r.min << ":" << r.sec << endl;
}

int main(int argc, const char *argv[]){
    Time t1(10, 15, 23);
    Date d1(2025, 9, 19);
    d1.show_date_and_time(t1);

    return 0;
}